#ifndef SCALE_MANAGER_H
#define SCALE_MANAGER_H

#include <QObject>
#include <QSize>
#include <QGraphicsPixmapItem>
#include "dragable_item.h"
#include "clothes_data.h"
#include <QGraphicsView>

class ScaleManager : public QObject {
    Q_OBJECT
public:
    explicit ScaleManager(QObject *parent = nullptr);

    // 计算缩放因子（根据窗口大小）
    qreal calculateScaleFactor(const QSize &windowSize);

    // 缩放人物
    void scaleCharacter(QGraphicsPixmapItem *characterItem, const QString &characterPath, qreal scaleFactor);

    // 缩放服饰
    void scaleClothes(
        DragablePixmapItem *upItem, DragablePixmapItem *downItem,
        DragablePixmapItem *dressItem, DragablePixmapItem *shoesItem,
        const std::function<ClothesInfo(DragablePixmapItem*)> &getInfoFunc,
        qreal scaleFactor
    );

    // 缩合合成图
    void scaleCombo(QGraphicsPixmapItem *comboItem, const QString &comboPath,
                   QGraphicsPixmapItem *characterItem, qreal scaleFactor);

    // 居中人物（略靠下）
    void centerCharacter(QGraphicsPixmapItem *characterItem, QGraphicsView *view);
    // 更新服饰位置（与人物对齐）
    void updateClothesPosition(
        DragablePixmapItem *upItem, DragablePixmapItem *downItem,
        DragablePixmapItem *dressItem, DragablePixmapItem *shoesItem,
        const std::function<ClothesInfo(DragablePixmapItem*)> &getInfoFunc,
        QGraphicsPixmapItem *characterItem
    );
};


#endif // SCALE_MANAGER_H
